package tgc.edu.tms.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import tgc.edu.tms.custom.CommonRepository;
import tgc.edu.tms.entity.Schedule;
@Repository
public interface ScheduleRepository extends CommonRepository<Schedule, Integer>{

	List<String> findByTeacher(String username);

	@Query(value = "SELECT DISTINCT kcmc FROM schedule where teacher=?1 and xnxq=?2", nativeQuery = true)
	public List<String> findAllKcmc(String name, String xq);

	public List<Schedule> findByTeacherAndKcmc(String name, String kcmc);

	public void deleteByXnxq(String xnxq);
	
	public List<Schedule> findByTeacherAndXnxq(String name, String xnxq);
	
	@Query(value="select max(id) from schedule",nativeQuery=true)
	public Integer findMaxId();
}
